﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace MethodAttributes
{

    class MethodAttributes
    {
        [Version(1 , "no comment")]
        public static void Sum(int num1 , int num2)
        {
        } 

        [Version(2, "No comment again")]
        public static void Sum1(int num2, int num3)
        {

        }
        static void Main(string[] args)
        {

            Type type = typeof(MethodAttributes);
        // Extracting all attributes of the clas
        object[] methods =
            type.GetMethods();

        foreach (var method in methods)
        {
            
            object[] attributes = ((MethodInfo)method).GetCustomAttributes(false);

            foreach (var attribute in attributes)
            {
                if (attribute is VersionAttribute)
                {
                    Console.WriteLine("Version:{0},Comment:{1}", ((VersionAttribute)attribute).Version, ((VersionAttribute)attribute).Comment);
                }
            }
        }
     
  
        }
        
    }
}
